package com.franklin.java.action.sql.entity.ui;

import com.franklin.plugins.common.collection.PrettyArrayList;
import com.franklin.plugins.common.utils.DataCheckUtils;
import com.intellij.ui.treeStructure.SimpleNode;

import java.util.Collections;
import java.util.List;

/**
 * @author Franklin
 * @since 2021/9/13 15:35
 */
public class CollectionNode extends ResultMapChildNode{

    private String property;
    private String ofType;

    protected CollectionNode(SimpleNode aParent) {
        super(aParent);
        setProperties();
    }

    @Override
    protected void setProperties() {
        this.properties = new PrettyArrayList<>();
    }

    @Override
    public boolean isSingleTag() {
        return false;
    }

    @Override
    protected String getJavaTypePropertyName() {
        return "ofType";
    }

    @Override
    protected String getGenericType() {
        String javaType = getProperty("javaType");
        if (DataCheckUtils.isNotEmpty(javaType)){
            return javaType;
        }
        return "java.util.List";
    }
}
